package staffSize;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * Date:2024/12/13
 * @author Isabella
 */
public class StaffSizeMapper extends Mapper<Object, Text,Text, IntWritable> {

    private static final Text citys = new Text();
    private static  final IntWritable num = new IntWritable();

    @Override
    protected void map(Object key, Text value, Mapper<Object, Text, Text, IntWritable>.Context context) throws IOException, InterruptedException {

        String[] fields = value.toString().split(",");

        String city = fields[7];
        String size = fields[1];


        citys.set(city+"_" + size);
        num.set(1);

        context.write(citys,num);

    }

}
